import React, { useState, useEffect } from 'react'
import HeaderNav from "@/components/header-nav"
import styles from "./index.module.less"
const { getSettings } = $globalServicer('home')

// 新增的函数，用于将文本转换为富文本
const parseTextToRichText = (text) => {
  // 使用正则表达式替换 \r\n 为 <br /> 标签
  return text.replace(/\r\n/g, '<br />');
};

const Login = () => {
  const [settingInfo, setSettingInfo] = useState(null)
  const fetchSettings = () => {
    getSettings('instruction_guide').then(res => {
      console.log('res=====', res)
      setSettingInfo(res)
    })
  }
  useEffect(() => {
    fetchSettings()
  }, [])
  return (
    <div className={styles.helpPage}>
      <div className="header">
        <HeaderNav title="使用介绍" backArrow={true}></HeaderNav>
      </div>
      <div className={styles.helpPageWrapper}>
        {/* <div 
          className={styles.helpContent} 
          dangerouslySetInnerHTML={{ __html: parseTextToRichText(settingInfo?.value || '') }}
        >
        </div> */}
        <div className={styles.desc} dangerouslySetInnerHTML={{ __html: settingInfo?.value }}>
        </div>
      </div>
    </div>
  );
};

export default Login;
